
def run(params:list[str]):    
    import json
    from ApiTools import apiTools,apiBase
    collects=apiBase.argv_array(params,1,'proc/extract/tablename;')
    usr_prompt=apiBase.argv(params,2,"hostname")
    fun_name=apiBase.argv(params,3,"qa")
    type=apiBase.argv_int(params,4,"0")
    ids=apiBase.argv_array(params,5)
    try:
        vectdb = apiTools.load_vec()
        vcts=apiTools.load_models().get_vects(collects,ids)
        txts=vectdb.clts_query(vcts, usr_prompt,fun_name,type)
        ret=json.dumps(txts,ensure_ascii=False)
        print(ret)
        return ret
    except Exception as e:
        print(f"function error:{e}")
        return f"function error:{e}"

#run(['rag_query', 'proc/extract/tablename', 'hostname', 'qa', '0,'])